package com.feedback.ui;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.inputmethod.InputMethodManager;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import com.feedback.b.d;
import com.feedback.c.b;
import com.feedback.c.c;
import com.mobclick.android.UmengConstants;
import com.mobclick.android.j;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.json.JSONArray;
import org.json.JSONObject;

public class SendFeedback extends Activity
{
  static boolean a = true;
  public static ExecutorService executorService = Executors.newFixedThreadPool(3);
  private Spinner b;
  private Spinner c;
  private EditText d;
  private TextView e;
  private TextView f;
  private ImageButton g;
  private JSONObject h;

  private void a()
  {
    this.b = ((Spinner)findViewById(j.a(this, "id", "umeng_analyse_feedback_age_spinner")));
    this.c = ((Spinner)findViewById(j.a(this, "id", "umeng_analyse_feedback_gender_spinner")));
    this.e = ((TextView)findViewById(j.a(this, "id", "umeng_analyse_feedback_submit")));
    this.d = ((EditText)findViewById(j.a(this, "id", "umeng_analyse_feedback_content")));
    this.f = ((TextView)findViewById(j.a(this, "id", "umeng_analyse_feedback_umeng_title")));
    this.g = ((ImageButton)findViewById(j.a(this, "id", "umeng_analyse_feedback_see_list_btn")));
    if (this.b != null)
    {
      ArrayAdapter localArrayAdapter1 = new ArrayAdapter(this, 17367048, getResources().getStringArray(j.a(this, "array", "UMageList")));
      localArrayAdapter1.setDropDownViewResource(17367049);
      this.b.setAdapter(localArrayAdapter1);
    }
    if (this.c != null)
    {
      ArrayAdapter localArrayAdapter2 = new ArrayAdapter(this, 17367048, getResources().getStringArray(j.a(this, "array", "UMgenderList")));
      localArrayAdapter2.setDropDownViewResource(17367049);
      this.c.setAdapter(localArrayAdapter2);
    }
    if (this.g != null)
      this.g.setOnClickListener(new e(this));
    b();
    c();
  }

  private void b()
  {
    if (this.f != null)
      this.f.setText(getString(j.a(this, "string", "UMFeedbackUmengTitle")));
    if (this.d != null)
      this.d.setHint(getString(j.a(this, "string", "UMFeedbackContent")));
    if (this.e != null)
      this.e.setText(getString(j.a(this, "string", "UMFeedbackSummit")));
  }

  private void c()
  {
    String str2;
    String str1 = getIntent().getStringExtra("feedback_id");
    if ((str1 != null) && (this.d != null))
    {
      str2 = getSharedPreferences("feedback", 0).getString(str1, null);
      if (!(c.a(str2)));
    }
    try
    {
      String str3 = new d(new JSONArray(str2).getJSONObject(0)).a();
      this.d.setText(str3);
      b.a(this, "feedback", str1);
      if (this.b != null)
      {
        int j = d();
        if (j != -1)
          this.b.setSelection(j);
      }
      if (this.c != null)
      {
        int i = e();
        if (i != -1)
          this.c.setSelection(i);
      }
      return;
    }
    catch (Exception localException)
    {
      if (!(UmengConstants.testMode));
      localException.printStackTrace();
    }
  }

  private int d()
  {
    return getSharedPreferences("UmengFb_Nums", 0).getInt("ageGroup", -1);
  }

  private int e()
  {
    return getSharedPreferences("UmengFb_Nums", 0).getInt("sex", -1);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    requestWindowFeature(1);
    setContentView(j.a(this, "layout", "umeng_analyse_send_feedback"));
    a();
    if (this.e != null)
    {
      this.e.setOnClickListener(new f(this, null));
      if (this.d != null)
        ((InputMethodManager)getSystemService("input_method")).toggleSoftInput(2, 0);
    }
  }
}